<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@ include file="/commons/taglibs.jsp" %>
<!DOCTYPE html>
<html>
<%@ include file="/commons/head.jsp" %>
<body class="hold-transition skin-blue sidebar-mini">
<div class="wrapper">
    <%@ include file="/commons/left.jsp" %>
    <div class="content-wrapper">
        <section class="content-header">
            <h1>
                版权信息
            </h1>
        </section>
        <div class="content">
            <div class="row">
                <div class="col-md-9">
                    <div class="box box-primary" style="overflow:hidden">
                        <form id="postForm" class="form-horizontal" autocomplete="off">
                            <input type="hidden" name="id" value="${entity.id}">
                            <div class="box-body" style="padding-top:30px">
                                <div class="form-group">
                                    <label for="enrollTime" class="col-sm-2 control-label">登记日期：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="enrollTime"
                                               name="enrollTime" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.enrollTime}"/>' readonly="readonly"
                                               onfocus="WdatePicker()" placeholder="登记日期">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="workName" class="col-sm-2 control-label">作品名称：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="workName"
                                               name="workName" value="${entity.workName}" placeholder="作品名称">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="worksCategory" class="col-sm-2 control-label">作品类别：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="worksCategory"
                                               name="worksCategory" value="${entity.worksCategory}" placeholder="作品类别">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="copyrightOwner" class="col-sm-2 control-label">著作权人姓名：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="copyrightOwner"
                                               name="copyrightOwner" value="${entity.copyrightOwner}" placeholder="著作权人姓名">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="finishTime" class="col-sm-2 control-label">创作完成日期：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="finishTime"
                                               name="finishTime" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.finishTime}"/>' readonly="readonly"
                                               onfocus="WdatePicker()" placeholder="创作完成日期">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="fristTime" class="col-sm-2 control-label">首次发表日期：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="fristTime"
                                               name="fristTime" value='<fmt:formatDate pattern="yyyy-MM-dd" value="${entity.fristTime}"/>' readonly="readonly"
                                               onfocus="WdatePicker()" placeholder="首次发表日期">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="workNum" class="col-sm-2 control-label">作品数量：</label>
                                    <div class="col-sm-5">
                                        <input type="number" class="form-control" autocomplete="off" id="workNum"
                                               name="workNum" value="${entity.workNum}" placeholder="作品数量">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="creativeNature" class="col-sm-2 control-label">创作性质：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="creativeNature"
                                               name="creativeNature" value="${entity.creativeNature}" placeholder="创作性质">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="nationality" class="col-sm-2 control-label">国籍：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="nationality"
                                               name="nationality" value="${entity.nationality}" placeholder="国籍">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="province" class="col-sm-2 control-label">省份：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="province"
                                               name="province" value="${entity.province}" placeholder="省份">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="city" class="col-sm-2 control-label">城市：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="city"
                                               name="city" value="${entity.city}" placeholder="城市">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="authorName" class="col-sm-2 control-label">作者姓名：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="authorName"
                                               name="authorName" value="${entity.authorName}" placeholder="作者姓名">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="acquisiRights" class="col-sm-2 control-label">取得方式：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="acquisiRights"
                                               name="acquisiRights" value="${entity.acquisiRights}" placeholder="取得方式">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="rightOwnership" class="col-sm-2 control-label">归属方式：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="rightOwnership"
                                               name="rightOwnership" value="${entity.rightOwnership}" placeholder="归属方式">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="registreInstitu" class="col-sm-2 control-label">登记机构：</label>
                                    <div class="col-sm-5">
                                        <input type="text" class="form-control" autocomplete="off" id="registreInstitu"
                                               name="registreInstitu" value="${entity.registreInstitu}" placeholder="登记机构">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <label for="selectIsStatis" class="col-sm-2 control-label">状态：</label>
                                    <div class="col-sm-3">
                                        <select class="form-control select2 select2-hidden-accessible"
                                                id="selectIsStatis"
                                                style="width: 100%;" tabindex="-1" aria-hidden="true" name="isStatus">
                                            <option value="0" <c:if test="${0 == entity.isStatus}">selected="selected"</c:if>>禁用</option>
                                            <option value="1" <c:if test="${1 == entity.isStatus}">selected="selected"</c:if>>启用</option>
                                            <option value="2" <c:if test="${2 == entity.isStatus}">selected="selected"</c:if>>推荐</option>
                                        </select>
                                    </div>
                                </div>
                            </div>
                            <div class="box-footer">
                                <div class="col-sm-2"></div>
                                <button type="button" class="btn btn-info" onclick="submitForm()">提交</button>
                            </div>
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <%@ include file="/commons/script.jsp" %>
    <script type="text/javascript" src="${ctx}/plugins/My97DatePicker/WdatePicker.js"></script>
    <script type="text/javascript">

        function submitForm() {
            var id = $('#postForm').find('input[name=id]').val();
            var url = null;
            if (id == null || id == "") {
                url = "${ctx}/copyright/saveCopyright?action=add";
            } else {
                url = "${ctx}/copyright/saveCopyright?action=update";
            }
            $.ajax({
                cache: false,
                type: "post",
                url: url,
                data: $('#postForm').serialize(),// formid
                error: function () {
                    alert("系统异常");
                },
                success: function (data) {
                    if (data !== null) {
                        if (data == 0) {
                            //修改失败
                            alert('失败');
                        } else {
                            //添加/修改成功
                            alert('成功');
                            window.location.href = "${ctx}/copyright/listCopyright";
                        }
                    }
                }
            });
        }
    </script>
</body>
</html>
